//品牌管理模块的接口
import request from "@/utils/request";
import type { ResponseData, TradeMark, TradeMarkResponseData } from "./type";
//品牌管理模块接口地址
enum API {
  TRADEMARK_URL = "/admin/product/baseTrademark/",
  //添加品牌
  ADDTRADEMARK_URL = "/admin/product/baseTrademark/save",
  //修改已有品牌
  UPDATETRADEMARK_URL = "/admin/product/baseTrademark/update",
  //删除已有品牌
  DELETE_URL = "/admin/product/baseTrademark/remove/",
}

//获取品牌列表的接口
export const reqTradeMarkList = (page: number, limit: number) =>
  request.get<any, TradeMarkResponseData>(
    API.TRADEMARK_URL + `${page}/${limit}`
  );
//添加与修改已有品牌接口方法
export const reqAddOrUpdateTradeMark = (data: TradeMark) => {
  if (data.id) {
    return request.put<any, ResponseData>(API.UPDATETRADEMARK_URL, data);
  } else {
    return request.post<any, ResponseData>(API.ADDTRADEMARK_URL, data);
  }
}
//删除已有品牌接口方法
export const reqDeleteTradeMark = (id: number) => request.delete<any, ResponseData>(API.DELETE_URL + id)